@extends('layouts.index')

@section('title',$default_name)

@section('content')
    <div class="layui-card">
        <div class="layui-card-header">
            <span class="layui-icon font-s10 color-desc margin-right-5">&#xe65b;</span> {{ $default_name }}
            <div class="pull-right">
                <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="delLog()">
                    清理日志
                </button>
                <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="delLog()">
                    删除日志
                </button>
            </div>
        </div>

        <div class="layui-card-body">
            <table class="layui-table">
                <caption class="margin-bottom-10 text-left">
                    <fieldset>
                        <form class="layui-form layui-form-pane form-search" method="get" autocomplete="off">
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">操作账号</label>
                                <div class="layui-input-inline">
                                    <select class="layui-select" name="loginname" id="loginname">
                                        <option value="">全部账号</option>
                                        @foreach($users as $user)
                                            <option
                                                value="{{ $user->loginname }}" {{ !empty($params) && $params['loginname'] == $user->loginname ? "selected" : "" }}>{{ $user->loginname }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>

                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">操作模块</label>
                                <div class="layui-input-inline">
                                    <input name="action" value="" placeholder="请输入操作行为" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">操作时间</label>
                                <div class="layui-input-inline">
                                    <input data-date-range="" name="create_at" value="" placeholder="请选择操作时间"
                                           class="layui-input" lay-key="12" autocomplete="off"></div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
                                <button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 重 置</button>
                            </div>
                        </form>
                    </fieldset>
                </caption>
                <thead>
                <tr>
                    <th class="list-table-check-td think-checkbox">
                        <input data-auto-none="" data-check-target=".list-check-box" type="checkbox"></th>
                    <th class="text-left nowrap" width="10%">模块</th>
                    <th class="text-left nowrap" width="10%">操作人</th>
                    <th class="text-left nowrap" width="10%">IP</th>
                    <th class="text-left nowrap" width="20%">数据</th>
                    <th class="text-left nowrap" width="10%">结果</th>
                    <th class="text-left nowrap" width="20%">操作时间</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                <tr data-dbclick="">
                    <td class="list-table-check-td think-checkbox"><input class="list-check-box" value="820"
                                                                          type="checkbox"></td>
                    <td class="text-left nowrap">
                        系统管理
                    </td>
                    <td class="text-left nowrap">
                        admin
                    </td>
                    <td class="text-left nowrap">
                        119.102.66.139
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        <a data-dbclick="" class="layui-btn layui-btn-xs layui-btn-danger">删 除</a>
                    </td>
                </tr>
                <tr data-dbclick="">
                    <td class="list-table-check-td think-checkbox"><input class="list-check-box" value="820"
                                                                          type="checkbox"></td>
                    <td class="text-left nowrap">
                        系统管理
                    </td>
                    <td class="text-left nowrap">
                        admin
                    </td>
                    <td class="text-left nowrap">
                        119.102.66.139
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        2019年04月08日
                    </td>
                    <td class="text-left nowrap">
                        <a data-dbclick="" class="layui-btn layui-btn-xs layui-btn-danger">删 除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript">
        function delLog(id) {
            var index = layer.confirm("确定删除日志吗？", {
                title: "系统提示",
                icon: 7,
                anim: 0,
                btn: ["确定", "取消"]
            }, function () {
                $.ajax({
                    url: '/log/del',
                    type: 'POST',
                    dataType: 'json',
                    ContentType: "application/json; charset=utf-8",
                    data: {"id": id},
                    success: function (result) {

                    }
                });
            }, function () {
                layer.close(index)
            });
        }
    </script>
@endsection

